﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;

namespace SoundCodec.Lame
{
    #region Enums
    public enum VBRMETHOD : int
    {
        VBR_METHOD_NONE = -1,
        VBR_METHOD_DEFAULT = 0,
        VBR_METHOD_OLD = 1,
        VBR_METHOD_NEW = 2,
        VBR_METHOD_MTRH = 3,
        VBR_METHOD_ABR = 4
    } 

    /// <summary>
    /// Contains the various Mpeg modes usable by LameEnc
    /// </summary>
    public enum MpegMode : uint
    {
        STEREO = 0,
        JOINT_STEREO,
        DUAL_CHANNEL, // Not useable by LameEnc
        MONO,
        NOT_SET,
        MAX_INDICATOR // Please refrain from using this
    }

    public enum LAME_QUALITY_PRESET : int
    {
        LQP_NOPRESET = -1,
        LQP_NORMAL_QUALITY = 0,
        LQP_LOW_QUALITY = 1,
        LQP_HIGH_QUALITY = 2,
        LQP_VOICE_QUALITY = 3,
        LQP_R3MIX = 4,
        LQP_VERYHIGH_QUALITY = 5,
        LQP_STANDARD = 6,
        LQP_FAST_STANDARD = 7,
        LQP_EXTREME = 8,
        LQP_FAST_EXTREME = 9,
        LQP_INSANE = 10,
        LQP_ABR = 11,
        LQP_CBR = 12,
        LQP_MEDIUM = 13,
        LQP_FAST_MEDIUM = 14,
        LQP_PHONE = 1000,
        LQP_SW = 2000,
        LQP_AM = 3000,
        LQP_FM = 4000,
        LQP_VOICE = 5000,
        LQP_RADIO = 6000,
        LQP_TAPE = 7000,
        LQP_HIFI = 8000,
        LQP_CD = 9000,
        LQP_STUDIO = 10000
    }
    #endregion

    #region Structs
    [StructLayout(LayoutKind.Sequential), Serializable]
    public struct MP3
    {
        public uint dwSampleRate;
        public byte byMode;
        public ushort wBitrate;
        public int bPrivate;
        public int bCRC;
        public int bCopyright;
        public int bOriginal;
    }

    [StructLayout(LayoutKind.Sequential), Serializable]
    public struct AAC
    {
        public uint dwSampleRate;
        public byte byMode;
        public ushort wBitrate;
        public byte byEncodingMethod;
    }

    [StructLayout(LayoutKind.Sequential, Size = 327), Serializable]
    public struct LHV1
    {
        public const uint MPEG1 = 1;
        public const uint MPEG2 = 0;

        public uint dwStructVersion;
        public uint dwStructSize;
        public uint dwSampleRate;
        public uint dwReSampleRate;
        public MpegMode nMode;
        public uint dwBitrate;
        public uint dwMaxBitrate;
        public LAME_QUALITY_PRESET nPreset;
        public uint dwMpegVersion;
        public bool bCopyright;
        public bool bCRC;
        public bool bOriginal;
        public bool bPrivate;
        public VBRMETHOD nVbrMethod;
        public bool bWriteVBRHeader;
        public bool bEnableVBR;
        public int nVBRQuality;
        public uint dwVbrAbr_bps;
        public bool bNoBitRes;
        public ushort nQuality;

    }
    #endregion

    #region Classes
    class Format
    {
        public Format()
        {
        }
    }
    #endregion
}
